mergeInto(LibraryManager.library, {

  Hello: function () {
    window.alert("Hello, world!");
  },

  LoadSound: function (file) {
    var context = window.audioContext;
    var request = new XMLHttpRequest();

    var path = Pointer_stringify(file);

    request.open('GET', path, true);
    request.responseType = 'arraybuffer';
    request.addEventListener('load', function (e) {
      context.decodeAudioData(this.response, function (buffer) {
        window.dict[path] = buffer;
      });
    }, false);
    request.send();
  },

  PlaySound: function (file, loop) {
    var path = Pointer_stringify(file);
    var buffer = window.dict[path];

    var source = window.audioContext.createBufferSource();
    source.buffer = buffer;
    source.connect(window.audioContext.destination);
    if (loop > 0)
      source.loop = true;
    else
      source.loop = false;

  	source.start(0);
  },
  
});